package VN.EDU.IMIC.DEVELOPER.VUVANLUANSWINGJTABLEJSON;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import vn.edu.imic.XmlProcess.XMLManagements;

public class readXML {

	public static void main(String[] args) {
		//1.Khai bao các datafile của lớp đối tượng
				List<Object> lisField = new ArrayList<Object>();
				lisField.add("ID");
				lisField.add("RollNo");
				lisField.add("Fullname");
				lisField.add("Email");
				lisField.add("Phone");
				lisField.add("Mark");
				//2 Khai bao khoi tao doi tuong cua thu vien
				XMLManagements objmanager = new XMLManagements();
				//3 Khai bao 01 doi tuong List <List<Hashmap>>
					try {List<List<HashMap<String, String>>> LisKQ =
							objmanager.XMLOfItems(lisField, "Student", "E:\\NewFile.xml");
						//4 duyet thong tin de hien thi ra ngoai
						HashMap<String, String> objhash = null;
						for(int i = 0; i<LisKQ.size();i++)
							for(int j = 0; j < LisKQ.get(i).size();j++){
								objhash = LisKQ.get(i).get(j);
								System.out.println("Id" + objhash.get("ID"));
								System.out.println("rollno" + objhash.get("RollNo"));
								System.out.println("Fullname" + objhash.get("Fullname"));
								System.out.println("Email" + objhash.get("Email"));
								System.out.println("Phone" + objhash.get("Phone"));
								System.out.println("Mark" + objhash.get("Mark"));
							}
					} catch (Exception e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
					

}
}
